#ifndef DRAWABLETEXTURE_H
#define DRAWABLETEXTURE_H

#include "DXGI.h"
#include "D3D11.h"
#include "DeviceManager.h"

class RenderTexture
{
public:
	RenderTexture(const DeviceManager* pDeviceManager, UINT width, UINT height, bool hasColorMap, DXGI_FORMAT colorFormat);
	
	void Release();

	ID3D11ShaderResourceView* GetColorMap();
	ID3D11ShaderResourceView* GetDepthMap();

	void Begin();
	void End();

private:
	UINT mWidth;
	UINT mHeight;
	DXGI_FORMAT mColorMapFormat;

	const DeviceManager* mpDeviceManager;

	ID3D11ShaderResourceView* mpColorMapSRV;
	ID3D11RenderTargetView* mpColorMapRTV;

	ID3D11ShaderResourceView* mpDepthMapSRV;
	ID3D11DepthStencilView* mpDepthMapDSV;

	D3D11_VIEWPORT mViewport;

	void BuildDepthMap();
	void BuildColorMap();
};

#endif